
package com.vinhvt.effiport.financial.ep;

import java.util.Date;


public class Transaction {	
	
	private String ticker;
	private Date date;
	private double openedPrice = 0;
	private double highestPrice = 0;
	private double lowestPrice = 0;
	private double closedPrice = 0;
	private long volume = 0;
	
	public Transaction(String ticker, Date date, double closedPrice) {
		setTicker(ticker);
		setDate(date);
		setClosedPrice(closedPrice);
	}
	
	/**
	 * Instantiates a new transaction.
	 * 
	 * @param asset the asset
	 * @param date the date
	 * @param closedPrice the closed price
	 */
	public Transaction(Security security, Date date, double closedPrice) {
		setTicker(security.getSymbol());
		setDate(date);
		setClosedPrice(closedPrice);		
	}
	
	/**
	 * Instantiates a new transaction.
	 * 
	 * @param asset the asset
	 * @param date the date
	 * @param closedPrice the closed price
	 * @param volume the volume
	 */
	public Transaction(Security security, Date date, double closedPrice, long volume) {
		setTicker(security.getSymbol());
		setDate(date);
		setClosedPrice(closedPrice);
		setVolume(volume);
	}
			
		
	public void setDate(Date date){
		this.date = date;
	}
	
	public Date getDate(){
		return this.date;
	}	
	
	public void setOpenedPrice(double openedPrice) {
		this.openedPrice = openedPrice;
	}
	
	public double getOpenedPrice() {
		return this.openedPrice;
	}
	
	public void setHightestPrice(double highestPrice){
		this.highestPrice = highestPrice;
	}
	public double getHighestPrice() {
		return this.highestPrice;
	}
	
	public void setLowestPrice(double lowestPrice) {
		this.lowestPrice = lowestPrice;
	}
	
	public double getLowestPrice() {
		return this.lowestPrice;		
	}
	
	public void setClosedPrice(double closedPrice){
		this.closedPrice = closedPrice;
	}
	
	public double getClosedPrice(){
		return this.closedPrice;
	}
	
	public void setVolume(long volume) {
		this.volume = volume;
	}
	
	public long getVolume() {
		return this.volume;
	}
	
	@Override
	public String toString() {
		String result = "";
		
		result += this.getTicker() + "   " + this.getDate() + "   " + this.getClosedPrice();
		
		return result;
	}

	public void setTicker(String ticker) {
		this.ticker = ticker;
	}

	public String getTicker() {
		return ticker;
	}
}
